var LogisticsComponent = React.createClass({
    componentDidMount: function() {
        var _this = this;
        _this.selector = $('#logistics');
        _this.handle();
    },
    receiveMsg: function(data) {
        console.log(data);
    },
    getInitialState: function () {
        return this.props ? this.props : {};
    },
    handleClick: function() {
        //eventFlux.dispatch(['index_slider_Event', 'index_init_Event'], {username: "xiaop"});
        //eventFlux.broadcast({username: "xiaop"});
    },
    handle: function(){
        var _this = this;

        // _this.selector.delegate('.u-expend', 'click', function(){
        //     if($(this).hasClass('closed')){
        //         $(this).parent('.list-title').next('.list-con').show();
        //         $(this).removeClass('closed');
        //     }else{
        //         $(this).parent('.list-title').next('.list-con').hide();
        //         $(this).addClass('closed');
        //     }
        // });

        _this.selector.delegate('.u-child-expend', 'click', function(){
            if($(this).hasClass('closed')){
                $(this).parent('.log-list-title').next('.log-list-con').show();
                $(this).removeClass('closed');
            }else{
                $(this).parent('.log-list-title').next('.log-list-con').hide();
                $(this).addClass('closed');
            }
        });
    },
    render:function() {


        var subOrderlist = {
            "ZD1711020918190210812713": [
                {
                    "trackMessage": "已成功受理，通知收货",
                    "messageTime": "2017-11-02 14:15:35"
                },
                {
                    "trackMessage": "下单成功，等待系统确认",
                    "messageTime": "2017-11-02 09:17:39"
                }
            ],
            "ZD1711020918190210839152": [
                {
                    "trackMessage": "已成功受理，通知收货",
                    "messageTime": "2017-11-02 14:15:35"
                },
                {
                    "trackMessage": "下单成功，等待系统确认",
                    "messageTime": "2017-11-02 09:17:38"
                }
            ],
            "ZD1711020918190210874250": [
                {
                    "trackMessage": "已成功受理，通知收货",
                    "messageTime": "2017-11-02 14:15:35"
                },
                {
                    "trackMessage": "下单成功，等待系统确认",
                    "messageTime": "2017-11-02 09:17:38"
                }
            ]
        };

        var list=[];
        for(var i in subOrderlist){
            var map = {
                subNum: i,
                subInfo: subOrderlist[i]
            };
            list.push(map);
        }

        return ~logistics;
    }
});
module.exports = LogisticsComponent;